/*
 * @Author: xgz
 * @Date: 2019-11-14 10:02:13
 * @Last Modified by: //此处填修改人名字
 * @Last Modified time: 2019-11-14 11:33:47
 */
<template>
  <section class="carTypeConfig">
    <el-dialog
      v-dialogDrag
      title="链接选择"
      :visible.sync="curPopupsVisible"
      width="1000px"
      center
      @close="sendCode"
      :close-on-click-modal="false"
      :append-to-body="true"
      ref="dialogMultipleTable"
    >
      <dialogHeader slot="title" :title="'链接选择'" :styleType="$store.state.app.dialogType"></dialogHeader>
      <one-table-template
        ref="multipleTable"
        :dynamicButtons="tableButtons"
        :dynamicComponents="tableComponents"
        :dynamicApiConfig="apiConfig"
        :dynamicTableCols="tableCols"
        :dynamicFormFields="formField"
        :dynamicIsShowSelect="isMul"
        :key="popupsTableKey"
      />
    </el-dialog>
  </section>
</template>
<script>
import { requestAPI } from "@/api/commonRequest";
import { oneTableWithViewTemplateMixins } from "@/components/mixins/oneTableWithViewTemplateMixins";
import { valueObjectMixins } from "@/components/mixins/valueObjectMixins";
import { crmApis } from "@/api/apiList/crm";
import OneTableTemplate from "@/components/crm/commonComponents/crmPopupsOneTable";
export default {
  // 组件混入对象：{data[listQuery] methods[queryTable]}
  mixins: [oneTableWithViewTemplateMixins, valueObjectMixins],
  components: {
    OneTableTemplate,
    dialogHeader: () => import("@/components/dialogHeader") //弹窗标题
  },
  data() {
    return {
      apiConfig: crmApis.crmDbLinkQueryFindAll,
      // 动态组件-按钮
      tableButtons: [
        {
          compKey: "btnKey1",
          type: "primary",
          size: "small",
          clickEvent: () => this.queryTable(1),
          text: "查询",
          position: "top"
        },
        {
          compKey: "btnKey2",
          type: "primary",
          size: "small",
          clickEvent: () => this.sendCode("linkId", "linkName"),
          text: "确认",
          position: "bottom"
        },
        {
          compKey: "btnKey3",
          type: "",
          size: "small",
          clickEvent: () => this.reset(),
          text: "重置",
          position: "top"
        }
      ],
      // 动态组件-查询条件
      tableComponents: [
        // 显示组件
        {
          compKey: "compKey1",
          labelName: "链接类型",
          codeField: "linkType",
          lookuptype: "CRM0016",
          disabled: this.isShow(this.valueObject),
          component: () => import("@/components/org/LookupValue"),
          type: "dropdownList",
          isMust: true,
          isMul: false
        },
        {
          compKey: "compKey2",
          labelName: "链接名称",
          codeField: "linkName",
          component: () => import("@/components/org/commonInput"),
          type: "inputText",
          isMust: true
        },
        {
          compKey: "compKey3",
          labelName: "是否启用",
          codeField: "isEnable",
          disabled: true,
          component: () => import("@/components/crm/Select/crmIsEnable"),
          type: "dropdownList",
          isMust: true,
          isMul: false
        }
      ],
      // 动态生成网格列
      tableCols: [
        { prop: "typeName", label: "链接类型", width: null, align: "center" },
        { prop: "linkCode", label: "链接编码", width: null, align: "center" },
        { prop: "linkName", label: "链接名称", width: null, align: "center" },
        { prop: "remark", label: "链接描述", width: null, align: "center" },
        { prop: "linkAdress", label: "链接地址", width: null, align: "center" },
        {
          prop: "isEnablName",
          label: "是否启用",
          width: null,
          align: "center"
        },
        {
          prop: "linkId",
          label: "链接ID",
          width: null,
          align: "center",
          hidden: true
        }
      ],
      //表单查询数据（查询条件）
      formField: {
        oemCode: "1",
        groupCode: "1",
        // linkCode: "",
        linkType: "",
        linkName: "",
        isEnable: "1"
      },
      //双击事件
      handleTableRowData:{
        value:"linkId",
        text:"linkName"
      }
    };
  },
  mounted() {
    this.formField.oemCode = this.$store.getters.orgInfo.OEM_CODE;
    this.formField.groupCode = this.$store.getters.orgInfo.GROUP_CODE;
  },
  methods: {
    isShow(obj) {
      debugger;
      if (obj.linkType) {
        return true;
      }
    }
  }
};
</script>
